package com.cnzhy.controller;

import com.cnzhy.entity.CrmAdminUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author: zhaoyan5
 */
@RestController
public class CrmAdminUserController {

    RestTemplate restTemplate;

    @Autowired
    public void setRestTemplate(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    @GetMapping("user/{userId}")
    public CrmAdminUser getCrmAdminUser(@PathVariable long userId) {
        return restTemplate.getForObject("http://producer/user/" + userId, CrmAdminUser.class);
    }

}
